package common.consts;

/**
 * Created by aceyin on 15/6/23.
 */
public enum YesNo {
    Yes('Y', 1, true), No('N', 0, false);

    public final char charVal;
    public final int intVal;
    public final boolean boolVal;

    YesNo(char charVal, int intVal, boolean boolVal) {
        this.boolVal = boolVal;
        this.intVal = intVal;
        this.charVal = charVal;
    }

    public static boolean isYes(Character c) {
        if (c == null) {
            return false;
        }
        return Yes.charVal == c.charValue();
    }

    public static boolean isYes(Integer i) {
        if (i == null) {
            return false;
        }
        return Yes.intVal == i.intValue();
    }

    public static boolean isYes(Boolean b) {
        if (b == null) {
            return false;
        }
        return Yes.boolVal == b.booleanValue();
    }

    public static boolean isNo(Character c) {
        if (c == null) {
            return true;
        }
        return No.charVal == c.charValue();
    }
}
